//
//  HRSelectMusicCell.m
//  Hear
//
//  Created by mac on 2017/4/6.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRSelectMusicCell.h"
#import "HRSelectBackGroundMusicModel.h"
@implementation HRSelectMusicCell


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        
        [self setupViews];
        
    }
    return self;
}
- (void)setupViews
{
    if (self.musicTypeButton) return;
    
    
    UIButton *musicTypeButton = [UIButton buttonWithType:0];
    musicTypeButton.enabled = NO;
    [musicTypeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [musicTypeButton setTitleColor:CustomColor(255, 112, 66, 1) forState:UIControlStateSelected];
    [musicTypeButton setBackgroundImage:[UIImage imageNamed:@"背景音效"] forState:0];
    musicTypeButton.titleLabel.font = CustomUIFont(13);
    [self addSubview:(self.musicTypeButton = musicTypeButton)];
    musicTypeButton.backgroundColor = CustomColor(160, 208, 207, 1);
    musicTypeButton.titleLabel.numberOfLines = 0;

    WeakSelf
    [musicTypeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.top.equalTo(weakSelf);
        make.left.equalTo(weakSelf).offset(5);
        make.right.equalTo(weakSelf).offset(-10);
    }];
    
}



-(void)setMusicModel:(HRSelectBackGroundMusicModel *)musicModel
{
    [self.musicTypeButton setTitle:musicModel.musicName forState:0];
    if (!musicModel.isSelect)
    {
        [self.musicTypeButton setTitleColor:[UIColor whiteColor] forState:0];
        
    }else{
        [self.musicTypeButton setTitleColor:CustomColor(255, 112, 66, 1) forState:0];
    }
}
@end
